package org.apache.dubbo.engine.protocol;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.rpc.Exporter;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol;

/**
 * @author liangcai_zhu
 * @Description TODO
 * @Date 2019/12/17 20:09
 */
public class ZYProtocol extends DubboProtocol {

  /**
   *  协议名称
   */
  public static final String NAME = "zyprotocol";
  /**
   * 给provider用的默认端口
   */
  public static final int DEFAULT_PORT = 20880;

  @Override
  public <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException {
    System.out.println("只会消费者调用时执行");
    return super.refer(type, url);
  }

  @Override
  public <T> Exporter<T> export(Invoker<T> invoker) throws RpcException {
    System.out.println("只会提供者调用时执行");
    return super.export(invoker);
  }
}
